package com.xml;

import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.IOException;

/**
 * Administrator
 *
 * @author jiangbang
 * @date 2016/8/25
 */
public class PersonDemo1 {

    public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {
        //1.获取解析工长
        SAXParserFactory factory = SAXParserFactory.newInstance();
        //2.从解析工厂获取解析器
        SAXParser parser = factory.newSAXParser();
        //3.加载文档 document 注册处理器
        //4.编写处理器
        parser.parse(Thread.currentThread().getContextClassLoader().getResourceAsStream("main/java/com/xml/person.xml"),new PersonHandler());

    }
}
